package dawnland03.model.action;

import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ScheduledExecutorService;

/**
 * User: Petru Obreja (obrejap@yahoo.com)
 * Date: Jan 19, 2010
 * Time: 10:12:48 PM
 */
public class ActionExecutor {

    private static final Integer NR_THREADS = 10; //the number of threads to keep in the pool, even if they are idle
    private static final ScheduledExecutorService scheduledExecutorService;

    static {
        scheduledExecutorService = Executors.newScheduledThreadPool(NR_THREADS);
    }

    static void scheduleAction(ActionRunnable actionRunnable, long delay) {
        scheduledExecutorService.schedule(actionRunnable, delay, TimeUnit.SECONDS);
    }
}
